export = function (sourceId: string, targetIds: Array<string>): ICreepConfig {
    return {
        //from
        source: (creep: Creep) => {
            //墓碑拾取功能
            let tube: string = creep.room.find(FIND_TOMBSTONES).filter(tomb => tomb.store.getUsedCapacity() > 0).map(tube => tube.id)[0];

            let spawn: Structure | Tombstone = Game.getObjectById(tube ? tube : sourceId);
            if (creep.memory.role == 'carrier1' || creep.memory.role == 'carrier4') spawn = Game.getObjectById(sourceId);
            if (creep.withdraw(spawn, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) creep.moveTo(spawn)
        },
        //to
        target: (creep: Creep) => {
            for (let i = 0; i < targetIds.length; i++) {
                let targetId: string = targetIds[i];
                let target: RoomObject = Game.getObjectById(targetId);
                if (!target) return;
                // if ("structureType" in target &&
                //     (<Structure>target).structureType === STRUCTURE_TOWER &&
                //     (<StructureStorage>target).store.getFreeCapacity(RESOURCE_ENERGY) < 1000) continue;
                if ('store' in target && (<StructureStorage>target).store != null && (<StructureStorage>target).store.getFreeCapacity(RESOURCE_ENERGY) > 0) {
                    if (creep.transfer(target, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                        creep.moveTo(target);
                        return
                    }
                }
            }
        },
        // 状态切换条件，稍后会给出具体实现
        switch: (creep: Creep) => creep.updateState()
    }
}